﻿using PSI.Common;
using PSI.DbUtility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PSI.DAL
{
       public  class StoreGoodsStockDAL
        {
                /// <summary>
                /// 获取指定商品没有添加库存记录的仓库编号集合
                /// </summary>
                /// <param name="goodsId"></param>
                /// <returns></returns>
                public List<int> GetHasNoStockStoreIds(int goodsId)
                {
                        string sql = $"select StoreId from StoreInfos where IsDeleted=0 and StoreId not in (select StoreId  from StoreGoodsStockInfos where goodsId = {goodsId} and storeid> 0)";
                        DataTable dt = SqlHelper.GetDataTable(sql, 1);
                        List<int> reStoreIds = new List<int>();
                        foreach (DataRow dr in dt.Rows)
                        {
                                int storeId = dr["StoreId"].ToString().GetInt();
                                reStoreIds.Add(storeId);
                        }
                        return reStoreIds;
                }
        }
}
